<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
	<link href="#springUrl('/static/css/bootstrap.min.css')" rel="stylesheet">
	<link href="#springUrl('/static/css/style.css')" rel="stylesheet">
</head>
<body class="white-bg">
<div class="ibox-content" style="width: 430px;">
   <form id="myForm" class="form-horizontal" autocomplete="off" enctype="multipart/form-data" data-validator-option="{theme:'default'}">
       <input type="hidden" name="id" value="$!{site.id}">
       <input type="hidden" name="provinceId" value="$!{provinceId}">
       <input type="hidden" name="cityId" value="$!{cityId}">
       <input type="hidden" name="province" value="$!{site.province}">
       <input type="hidden" name="city" value="$!{site.city}">
       <input type="hidden" name="dist" value="$!{site.dist}">
       <input type="hidden" name="score" value="$!{site.score}">
       <div class="form-group"><label class="col-sm-2 control-label">场地名称</label>
           <div class="col-sm-10">
               <input type="text"  class="input-s-sm2" name="siteName"   value="$!{site.siteName}"  placeholder="请输入场地名称" data-rule="场地名称:required;siteName">
           </div>
       </div>
       <div class="form-group"><label class="col-sm-2 control-label">场地简介</label>
           <div class="col-sm-10">
               <textarea  id="description" style="width: 50%;height:100px"  class="form-control social-comment textarea"    name="description"  placeholder="请输入场地简介" data-rule="场地简介:required;description"></textarea>
           </div>
       </div>
       <div class="form-group"><label class="col-sm-2 control-label">邮政编码</label>
           <div class="col-sm-10">
               <input type="text"  class="input-s-sm2" name="postCode"   value="$!{site.postCode}"  placeholder="邮政编码" data-rule="邮政编码:required;contact">
           </div>
       </div>
       <div class="form-group"><label class="col-sm-2 control-label">联系人</label>
           <div class="col-sm-10">
               <input type="text"  class="input-s-sm2" name="contact"   value="$!{site.contact}"  placeholder="联系人" data-rule="联系人:required;contact">
           </div>
       </div>

       <div class="form-group"><label class="col-sm-2 control-label">东经</label>
           <div class="col-sm-10">
               <input name="locationType" type="hidden"  value="1"/>
               <input type="text" class="input-s-sm2"  id="longitude" name="longitude" readonly value="$!{site.longitude}" placeholder="请输入东经" data-rule="东经:required;long">
           </div>
       </div>
       <div class="form-group"><label class="col-sm-2 control-label">北纬</label>
           <div class="col-sm-10">
               <input type="text" class="input-s-sm2"  id="latitude"  name="latitude" readonly value="$!{site.latitude}"  placeholder="请输入北纬" data-rule="北纬:required;lat">
           </div>
       </div>
       <div class="form-group"><label class="col-sm-2 control-label">地图</label>
           <div class="col-sm-10">
               <div id="allmap" style="width:800px;height:240px;"></div>
           </div>
       </div>

       <div class="form-group"><label class="col-sm-2 control-label">场地信息:</label>
           <div id="siteDetailDiv" class="col-sm-10">
               <script type="text/plain"  name="siteDetail" id="siteDetail" style="width:800px;height:240px;">$!{site.siteDetail}</script>
               <input id="siteFile"  name="siteFile"  value="$!{site.siteFile}" type="hidden"/>
                   </div>
                   </div>
                   <div class="form-group">
                   <label class="col-sm-2 control-label">附件:</label>
               <div  class="col-sm-10" style="width: 55%;">
                   <form enctype="multipart/form-data"class="col-sm-10" >
                   <a id="siteFileUrl" name="siteFileUrl" title="暂无文件" target="_blank"><font style="font-weight: 900;color: #3C9D40;">暂无文件</font></a>
               <div class="file-loading"  style="width: 60%">
                   <input  name="siteFileUpload" id="siteFileUpload" class="file" style="width: 60%;" type="file" multiple data-min-file-count="1" >
                   </div>
                   </form>
                   </div>
                   </div>
                   <div class="form-group">
                   <div class="text-center">
                   <button class="btn btn-primary" onclick="saveSiteInfo()">保 存</button>
               </div>
       </div>
    </form>
</div>
<script src="#springUrl('/static/js/jquery-2.1.1.js')"></script>
<script src="#springUrl('/static/plugins/nice-validator-0.8.1/jquery.validator.js?local=zh-CN')"></script>
<script type="text/javascript">
    $("#myForm").validator({
        valid: function(form){
            var me = this;
            // 提交表单之前，hold住表单，防止重复提交
            me.holdSubmit();
            $.ajax({
                url: "#",
                data: $(form).serialize(),
                type: "POST",
                success: function(data){
                    var d = JSON.parse(data);
                    if(d.success && d.data){
                        window.parent.location.reload();
                        //当你在iframe页面关闭自身时
                        //var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                        //parent.layer.close(index); //再执行关闭
                    } else {
                        //失败，提交表单成功后，释放hold，如果不释放hold，就变成了只能提交一次的表单
                        me.holdSubmit(false);
                    }
                }
            });
        }
    });
</script>
</body>
</html>
